package org.dtrd.modules.patient.entity.bean.report;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * @author qr
 * @date 2022/4/8 12:50
 */
@ApiModel(value = "更新总结报告请求")
@Getter
@Setter
public class ReportSummaryUpdateRequest {

    @ApiModelProperty(value = "报告id", required = true)
    @NotNull
    private Integer reportId;

    @ApiModelProperty(value = "文档类型，1-体格检查，2-实验室检查，3-影像学检查")
    private Integer archiveType;

    @ApiModelProperty("报告状态, 0-未发布, 1-发布")
    private Integer status;

    @ApiModelProperty(value = "体型照片", required = true)
    private String bodyPictures;

    @ApiModelProperty(value = "报告单图片，多张图片使用,进行分割")
    private String reportPictures;

    @ApiModelProperty(value = "健康处方", required = true)
    @NotBlank
    private ReportWeekSuggest prescription;

    @ApiModelProperty(value = "总结", required = true)
    @NotBlank
    private String summary;

    @ApiModelProperty("实验室检查输入数据")
    private Map<Integer, Float> laboratoryMap;

    @ApiModel("数据库保存前端输入的Json类")
    @Getter
    @Setter
    public static class ReportSummaryInputUpdate {
        @ApiModelProperty(value = "健康处方", required = true)
        private ReportWeekSuggest prescription = new ReportWeekSuggest();

        @ApiModelProperty(value = "体型照片", required = true)
        private String bodyPictures;

        @ApiModelProperty(value = "前端上传的报告单图片路径，多张图片使用,进行分割")
        private String reportPictures;

        /**
         * 将数据转化为Json进行保存
         * @return
         */
        public ReportSummaryUpdateRequest.ReportSummaryInputUpdate makeJson(ReportSummaryUpdateRequest po) {
            ReportSummaryUpdateRequest.ReportSummaryInputUpdate reportSummaryInputUpdate = new ReportSummaryUpdateRequest.ReportSummaryInputUpdate();
            reportSummaryInputUpdate.setPrescription(po.prescription);
            reportSummaryInputUpdate.setReportPictures(po.reportPictures);
            reportSummaryInputUpdate.setBodyPictures(po.bodyPictures);
            return reportSummaryInputUpdate;
        }
    }
}
